package org.TheSubject;



public class Solution12OfHot {
    static int[] allNums={1000,900,500,400,100,90,50,40,10,9,5,4,1};
    static String[] allString={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
    public String intToRoman(int num) {

        StringBuilder result=new StringBuilder();

        for (int i=0;i<allNums.length;i++){

            int val=allNums[i];
            String s=allString[i];
            while (num>val){
                num-=val;
                result.append(s);
            }
        }

        return result.toString();
    }
}
